package com.ruoyi.ade.service.impl;

import java.util.List;

import com.ruoyi.ade.domain.Standard;
import com.ruoyi.ade.mapper.AdeLabKfoldResultMapper;
import com.ruoyi.ade.mapper.AdeLabResultMapper;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ade.mapper.AdeLabMapper;
import com.ruoyi.ade.domain.AdeLab;
import com.ruoyi.ade.service.IAdeLabService;
import org.springframework.transaction.annotation.Transactional;

/**
 * AdeLabService业务层处理
 * 
 * @author wxh
 * @date 2025-06-28
 */
@Service
public class AdeLabServiceImpl implements IAdeLabService 
{
    @Autowired
    private AdeLabMapper adeLabMapper;

    @Autowired
    private AdeLabResultMapper adeLabResultMapper;

    @Autowired
    private AdeLabKfoldResultMapper adeLabKfoldResultMapper;

    /**
     * 查询AdeLab
     * 
     * @param id AdeLab主键
     * @return AdeLab
     */
    @Override
    public AdeLab selectAdeLabById(Long id)
    {
        return adeLabMapper.selectAdeLabById(id);
    }

    /**
     * 查询AdeLab列表
     * 
     * @param adeLab AdeLab
     * @return AdeLab
     */
    @Override
    public List<AdeLab> selectAdeLabList(AdeLab adeLab)
    {
        return adeLabMapper.selectAdeLabList(adeLab);
    }

    /**
     * 新增AdeLab
     * 
     * @param adeLab AdeLab
     * @return 结果
     */
    @Override
    public int insertAdeLab(AdeLab adeLab)
    {
        adeLab.setCreateTime(DateUtils.getNowDate());
        return adeLabMapper.insertAdeLab(adeLab);
    }

    /**
     * 修改AdeLab
     * 
     * @param adeLab AdeLab
     * @return 结果
     */
    @Override
    public int updateAdeLab(AdeLab adeLab)
    {
        adeLab.setUpdateTime(DateUtils.getNowDate());
        return adeLabMapper.updateAdeLab(adeLab);
    }

    /**
     * 批量删除AdeLab
     * 
     * @param ids 需要删除的AdeLab主键
     * @return 结果
     */
    @Override
    @Transactional
    public int deleteAdeLabByIds(Long[] ids)
    {
        for(Long id:ids) {
            adeLabResultMapper.deleteAdeLabResultByLabId(id);
            adeLabKfoldResultMapper.deleteAdeLabKfoldResultByLabId(id);
        }
        return adeLabMapper.deleteAdeLabByIds(ids);
    }

    /**
     * 删除AdeLab信息
     * 
     * @param id AdeLab主键
     * @return 结果
     */
    @Override
    public int deleteAdeLabById(Long id)
    {
        return adeLabMapper.deleteAdeLabById(id);
    }
}
